﻿#ifndef PLAYERONQMEDIABL_H
#define PLAYERONQMEDIABL_H
///
/// \brief 该层统一调用接口，根据用户选择的引擎分配不懂的对象
/// 
#include "Utils/QPTypes.h"
#include <QObject>

class PlayerBase;

class PlayerOnQMediaBL:public QObject
{
    Q_OBJECT
public:
    PlayerOnQMediaBL(QObject * parent = nullptr);
    ~PlayerOnQMediaBL();
    
    bool open(const QString& media);//打开文件
    bool play();//播放
    bool pause();//暂停
    bool stop();//停止
    
    QP::PlaybackState state()const;//播放状态
    void setState(QP::PlaybackState state); //设置播放状态
    
    float volume() const;//音量
    void setVolume(float volume);//设置音量
    
    bool isMuted() const;//是否静音
    void setMuted(bool muted);//设置静音
    void setPlaybackRate(float rate);//播放速率 0.5/0.75/1.0/1.5/2.0......
    
    void setVideoWidget(QObject *w);
    
    void setEngine(QP::PlayEngine type);
    QP::PlayEngine Engine();
private:
    PlayerBase *abs_Player;
    QP::PlayEngine EngineType;
    QP::PlaybackState PlayState;
};

#endif // PLAYERONQMEDIABL_H
